//
//  HEOrgHeadCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/26.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEOrgHeadCell.h"
#import "HEOldPelOrgModel.h"

@interface HEOrgHeadCell ()

@property(nonatomic, strong) UIImageView *logoView;
@property(nonatomic, strong) UILabel *titleLb;

@end

@implementation HEOrgHeadCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = CLightGrayColor;
        
        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    UIImageView *logoView = [UIImageView new];
    _logoView = logoView;
    logoView.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:logoView];
    
    _titleLb = [UILabel new];
    _titleLb.font = DYBlodFont(18);
    _titleLb.text = @"-";
    _titleLb.textColor = CNavLightBlackColor;
    _titleLb.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_titleLb];
    
    
    [_logoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(15);
        make.centerX.equalTo(self.contentView);
        make.width.mas_offset(100);
        make.height.mas_offset(100);
    }];
    [_logoView hg_setAllCornerWithCornerRadius: 50];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_logoView.mas_bottom).mas_offset(15);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.bottom.equalTo(self.contentView).mas_offset(-5);
    }];
}
 
- (void)configCellWithModel:(HEOldPelOrgModel *)model {
    [_logoView sd_setImageWithURL:[NSURL URLWithString:model.image_src] placeholderImage:IMAGE_NAMED(@"noImage")];
    _titleLb.text = model.company_name;
}

- (void)refreshCellData:(NSIndexPath *)indexPath {
     
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
